package com.foreveross.fetl.util;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import com.foreveross.fetl.common.vo.hangxin.FlightInfo;
import com.foreveross.fetl.common.vo.hangxin.PlaneInfo;
import com.foreveross.fetl.common.vo.hangxin.StopoverInfo;
import com.foreveross.fetl.common.vo.hangxin.TransitInfo;
import com.foreveross.fetl.common.vo.hangxin.TripInfo;
import com.foreveross.fetl.common.vo.model.Cabin;
import com.foreveross.fetl.common.vo.model.SinglePlaneInfo;
import com.foreveross.fetl.common.vo.model.StopOver;
import com.foreveross.fetl.common.vo.model.Transit;
import com.foreveross.fetl.common.vo.model.doub.DoublePlaneInfo;
import com.foreveross.fetl.common.vo.model.doub.ReturnCabin;
import com.foreveross.fetl.common.vo.model.doub.ReturnDoublePlaneInfo;
import com.foreveross.fetl.common.vo.model.doub.ReturnStopOver;
import com.foreveross.fetl.common.vo.model.doub.ReturnTransit;

public class PlaneInfoUtil {
	
	public static String timeInMillis2Time(Long diff){
		   long diffMinutes = diff / (60 * 1000)%60; 
		   long diffHours = diff / (60 * 60 * 1000); 
		   String hour ="";
		   String min="";
		   if(diffHours<10){
			   hour="0"+diffHours;
		   }else{
			   hour=""+diffHours;
		   }
		   if(diffMinutes<10){
			   min="0"+diffMinutes;
		   }else{
			   min=""+diffMinutes;
		   }
		   return hour+":"+min;
	   }
	
	/**
	    * 计算两个时间差
	    * @param start
	    * @param end
	    * @return
	    */
	public static  String dateDifference(Date start,Date end){
		   if(null ==start || null== end){
			   return "00:00";
		   }
		   Calendar cstart = Calendar.getInstance(); 
		   Calendar cend = Calendar.getInstance();
		   cstart.setTime(start);
		   cend.setTime(end);
		   long millisecondsStart =cstart.getTimeInMillis();
		   long millisecondsEnd =cend.getTimeInMillis();
		   long diff =millisecondsEnd-millisecondsStart;
		   if(diff<=0){
			   return "00:00";
		   }
		   return timeInMillis2Time(diff);
		   
	   }
	

	public static PlaneInfo changeToPlaneInfo(SinglePlaneInfo singleVO){
		TripInfo goTrip=new TripInfo();
		goTrip.setEndTime(singleVO.getEndTime());
		goTrip.setFromCity(singleVO.getFromCity());
		goTrip.setStartTime(singleVO.getStartTime());
		goTrip.setToCity(singleVO.getToCity());
		if(singleVO.getFlightDuration()!=null && singleVO.getFlightDuration()>0){
			goTrip.setTotalTime(timeInMillis2Time(singleVO.getFlightDuration()));
		}
		goTrip.setTrainsType(singleVO.getTrainsType());
		List<FlightInfo> flights =new ArrayList<FlightInfo>();
		if(null!=singleVO.getTransits() && singleVO.getTransits().size()>1){
			List<TransitInfo> transitInfos =new ArrayList<TransitInfo>();
			
			int i=0;
			Date arrivalTime=null;
			Long stayTime=null;
			
			for(Transit transitVO:singleVO.getTransits()){
				FlightInfo flightInfo =new FlightInfo();
				String carrier=transitVO.getCarrierFullName();
				if(null==carrier){
					carrier=transitVO.getCarrierName();
				}
				flightInfo.setCarrier(carrier);
				flightInfo.setCabin(transitVO.getCabinName());
				flightInfo.setEndTime(transitVO.getEndTime());
				flightInfo.setStartTime(transitVO.getStartTime());
				flightInfo.setFlightNo(transitVO.getFlightNo());
				flightInfo.setFlightType(transitVO.getFlightType());
				
				flightInfo.setSequence(i+1);
				
				if(i==0){
					flightInfo.setFromCity(singleVO.getFromCity());
					flightInfo.setFromCityName(singleVO.getFromCityName());
				}else{
					flightInfo.setFromCity(transitVO.getFromAirPort());
					flightInfo.setFromCityName(transitVO.getFromAirPortName());
				}
				if(i==singleVO.getTransits().size()-1){
					flightInfo.setToCity(singleVO.getToCity());
					flightInfo.setToCityName(singleVO.getToCityName());
				}else{
					flightInfo.setToCity(transitVO.getToAirPort());
					flightInfo.setToCityName(transitVO.getToAirPortName());
				}
				flights.add(flightInfo);
				
				if(i>0){
				
					TransitInfo transitInfo=new TransitInfo();
					transitInfo.setArrivalTime(arrivalTime);
					transitInfo.setDepartureTime(transitVO.getStartTime());
					transitInfo.setSequence(i);
					transitInfo.setPort(transitVO.getFromAirPort());
					transitInfo.setPortName(transitVO.getFromAirPortName());
		//			transitInfo.setStayTime(transitVO.getStartTime());
//					if(null!=arrivalTime && null!=transitVO.getStartTime()){
//						transitInfo.setStayTime(dateDifference(arrivalTime, transitVO.getStartTime()));
//					}else 
					if(stayTime!=null && stayTime>0){
						transitInfo.setStayTime(timeInMillis2Time(stayTime));
					}
					transitInfos.add(transitInfo);
				}
				arrivalTime=transitVO.getEndTime();
				stayTime=transitVO.getStayTime();
				i++;
			}
			
			goTrip.setTransits(transitInfos);
			
		}else{
			FlightInfo flightInfo =new FlightInfo();
			String carrier=singleVO.getCarrierFullName();
			if(null==carrier){
				carrier=singleVO.getCarrierName();
			}
			flightInfo.setCarrier(carrier);
		//	flightInfo.setCabin(cabin);
			flightInfo.setEndTime(singleVO.getEndTime());
			flightInfo.setStartTime(singleVO.getStartTime());
			flightInfo.setFlightNo(singleVO.getFlightNo());
			flightInfo.setFlightType(singleVO.getFlightType());
			flightInfo.setFromCity(singleVO.getFromCity());
			flightInfo.setFromCityName(singleVO.getFromCityName());
			flightInfo.setToCity(singleVO.getToCity());
			flightInfo.setToCityName(singleVO.getToCityName());
			flightInfo.setSequence(1);
			flights.add(flightInfo);
			
		}
		if(null!=singleVO.getStopOvers() && singleVO.getStopOvers().size()>0){
			List<StopoverInfo> stopovers=new ArrayList<StopoverInfo>();
			int i=1;
			for(StopOver stopOverVO:singleVO.getStopOvers()){
				StopoverInfo stopoverInfo =new StopoverInfo();
				i++;
				stopoverInfo.setArrivalTime(stopOverVO.getArrTime());
				stopoverInfo.setDepartureTime(stopOverVO.getLeaveTime());
				stopoverInfo.setCity(stopOverVO.getStopCity());
//				if(null!=stopOverVO.getArrTime() && null!= stopOverVO.getLeaveTime()){
//					stopoverInfo.setStayTime(dateDifference(stopOverVO.getArrTime(), stopOverVO.getLeaveTime()));
//				}else 
				if(null!=stopOverVO.getStayTime() && stopOverVO.getStayTime()>0){
					stopoverInfo.setStayTime(timeInMillis2Time(stopOverVO.getStayTime()));
				}
				
				stopovers.add(stopoverInfo);
			}
			flights.get(0).setStopovers(stopovers);
		}
		
		
		if(null!=singleVO.getCabins()&&singleVO.getCabins().size()>0){
			Cabin lowestCabinVO =null;
			for(Cabin cabin:singleVO.getCabins()){
				if(null!=cabin.getPrice() && cabin.getPrice()>0){
					if(null==lowestCabinVO ){
						lowestCabinVO=cabin;
					}else if(cabin.getPrice()<lowestCabinVO.getPrice()){
						lowestCabinVO=cabin;
					}
				}else if(null!=cabin.getOriginalPrice() && cabin.getOriginalPrice()>0){
					if(null==lowestCabinVO ){
						lowestCabinVO=cabin;
					}else if(cabin.getOriginalPrice()<lowestCabinVO.getOriginalPrice()){
						lowestCabinVO=cabin;
					}
				}
			}
			if(null!=lowestCabinVO && null!=lowestCabinVO.getPrice() ){
				if(flights.get(0).getCabin()==null)
				flights.get(0).setCabin(lowestCabinVO.getSubCabinName()==null?lowestCabinVO.getCabinType():lowestCabinVO.getSubCabinName());
			}
			
		}
		
		goTrip.setTotalLowestTaxesPrice(singleVO.getTotalLowestTaxesPrice());
		goTrip.setLowestPrice(singleVO.getTotalLowestPrice());
		goTrip.setSumLowestPrice(singleVO.getSumLowestPrice());
		
		goTrip.setFlights(flights);
		
		PlaneInfo planeInfo =new PlaneInfo();
		planeInfo.setFlightDate(singleVO.getFlightDate());
		planeInfo.setFromCity(singleVO.getFromCity());
		planeInfo.setFromCityName(singleVO.getFromCityName());
		planeInfo.setToCity(singleVO.getToCity());
		planeInfo.setToCityName(singleVO.getToCityName());
		planeInfo.setGrabDate(singleVO.getGrabDate());
		planeInfo.setGrabChannel(singleVO.getAttachHbaseKey());
		planeInfo.setGrabChannelName(singleVO.getGrabChannelName());
		planeInfo.setGoTrip(goTrip);
		planeInfo.setTotalLowestTaxesPrice(singleVO.getTotalLowestTaxesPrice());
		planeInfo.setLowestPrice(singleVO.getTotalLowestPrice());
		planeInfo.setSumLowestPrice(singleVO.getSumLowestPrice());
		
		return planeInfo;
	}
	
	
	public static List<PlaneInfo> changeToPlaneInfo(DoublePlaneInfo doubVO) {
		List<PlaneInfo> list =new ArrayList<PlaneInfo>();
		
		//去程信息
		TripInfo goTrip=new TripInfo();
		goTrip.setEndTime(doubVO.getEndTime());
		goTrip.setFromCity(doubVO.getFromCity());
		goTrip.setStartTime(doubVO.getStartTime());
		goTrip.setToCity(doubVO.getToCity());
		if(doubVO.getFlightDuration()!=null && doubVO.getFlightDuration()>0){
		
		//	System.out.println(doubVO.getFlightDuration());
			goTrip.setTotalTime(timeInMillis2Time(doubVO.getFlightDuration()));
			//System.out.println(goTrip.getTotalTime());
		}
		goTrip.setTrainsType(doubVO.getTrainsType());
		List<FlightInfo> flights =new ArrayList<FlightInfo>();
		if(null!=doubVO.getTransits() && doubVO.getTransits().size()>1){
			List<TransitInfo> transitInfos =new ArrayList<TransitInfo>();
			
			int i=0;
			Date arrivalTime=null;
			Long stayTime=null;
			
			for(Transit transitVO:doubVO.getTransits()){
				FlightInfo flightInfo =new FlightInfo();
				String carrier=transitVO.getCarrierFullName();
				if(null==carrier){
					carrier=transitVO.getCarrierName();
				}
				//计数
				flightInfo.setSequence(i+1);
				
				flightInfo.setCarrier(carrier);
				flightInfo.setCabin(transitVO.getCabinName());
				flightInfo.setEndTime(transitVO.getEndTime());
				flightInfo.setStartTime(transitVO.getStartTime());
				flightInfo.setFlightNo(transitVO.getFlightNo());
				flightInfo.setFlightType(transitVO.getFlightType());
				
				if(i==0){
					flightInfo.setFromCity(doubVO.getFromCity());
					flightInfo.setFromCityName(doubVO.getFromCityName());
				}else{
					flightInfo.setFromCity(transitVO.getFromAirPort());
					flightInfo.setFromCityName(transitVO.getFromAirPortName());
				}
				if(i==doubVO.getTransits().size()-1){
					flightInfo.setToCity(doubVO.getToCity());
					flightInfo.setToCityName(doubVO.getToCityName());
				}else{
					flightInfo.setToCity(transitVO.getToAirPort());
					flightInfo.setToCityName(transitVO.getToAirPortName());
				}
				flights.add(flightInfo);
				
				if(i>0){
					TransitInfo transitInfo=new TransitInfo();
					transitInfo.setArrivalTime(arrivalTime);
					transitInfo.setDepartureTime(transitVO.getStartTime());
					transitInfo.setSequence(i);
					transitInfo.setPort(transitVO.getFromAirPort());
					transitInfo.setPortName(transitVO.getFromAirPortName());
//					if(null!=arrivalTime && null!=transitVO.getStartTime()){
//						transitInfo.setStayTime(dateDifference(arrivalTime, transitVO.getStartTime()));
//					}else
					if(stayTime!=null && stayTime>0){
						transitInfo.setStayTime(timeInMillis2Time(stayTime));
					}
					transitInfos.add(transitInfo);
				}
				arrivalTime=transitVO.getEndTime();
				stayTime=transitVO.getStayTime();
				i++;
			}
			
			goTrip.setTransits(transitInfos);
			
		}else{
			FlightInfo flightInfo =new FlightInfo();
			String carrier=doubVO.getCarrierFullName();
			if(null==carrier){
				carrier=doubVO.getCarrierName();
			}
			flightInfo.setCarrier(carrier);
			flightInfo.setSequence(1);
		//	flightInfo.setCabin(cabin);
			flightInfo.setEndTime(doubVO.getEndTime());
			flightInfo.setStartTime(doubVO.getStartTime());
			flightInfo.setFlightNo(doubVO.getFlightNo());
			flightInfo.setFlightType(doubVO.getFlightType());
			flightInfo.setFromCity(doubVO.getFromCity());
			flightInfo.setFromCityName(doubVO.getFromCityName());
			flightInfo.setToCity(doubVO.getToCity());
			flightInfo.setToCityName(doubVO.getToCityName());
			flights.add(flightInfo);
			
		}
		if(null!=doubVO.getStopOvers() && doubVO.getStopOvers().size()>0){
			List<StopoverInfo> stopovers=new ArrayList<StopoverInfo>();
			int i=1;
			for(StopOver stopOverVO:doubVO.getStopOvers()){
				StopoverInfo stopoverInfo =new StopoverInfo();
				i++;
				stopoverInfo.setArrivalTime(stopOverVO.getArrTime());
				stopoverInfo.setDepartureTime(stopOverVO.getLeaveTime());
				stopoverInfo.setCity(stopOverVO.getStopCity());
//				if(null!=stopOverVO.getArrTime() && null!= stopOverVO.getLeaveTime()){
//					stopoverInfo.setStayTime(dateDifference(stopOverVO.getArrTime(), stopOverVO.getLeaveTime()));
//				}else 
				if(null!=stopOverVO.getStayTime() && stopOverVO.getStayTime()>0){
					stopoverInfo.setStayTime(timeInMillis2Time(stopOverVO.getStayTime()));
				}
				
				stopovers.add(stopoverInfo);
			}
			flights.get(0).setStopovers(stopovers);
		}
		
		
		if(null!=doubVO.getCabins()&&doubVO.getCabins().size()>0){
			Cabin lowestCabinVO =null;
			for(Cabin cabin:doubVO.getCabins()){
				if(null!=cabin.getPrice() && cabin.getPrice()>0){
					if(null==lowestCabinVO ){
						lowestCabinVO=cabin;
					}else if(cabin.getPrice()<lowestCabinVO.getPrice()){
						lowestCabinVO=cabin;
					}
				}else if(null!=cabin.getOriginalPrice() && cabin.getOriginalPrice()>0){
					if(null==lowestCabinVO ){
						lowestCabinVO=cabin;
					}else if(cabin.getOriginalPrice()<lowestCabinVO.getOriginalPrice()){
						lowestCabinVO=cabin;
					}
				}
			}
			if(null!=lowestCabinVO && null!=lowestCabinVO.getPrice() ){
				if(  (lowestCabinVO.getPrice()>0 && lowestCabinVO.getPrice().intValue()!=doubVO.getTotalLowestPrice().intValue()) ||
						(lowestCabinVO.getOriginalPrice()>0 && lowestCabinVO.getOriginalPrice().intValue()!=doubVO.getSumLowestPrice().intValue()) ){
					goTrip.setTotalLowestTaxesPrice(lowestCabinVO.getTaxesPrice());
					goTrip.setLowestPrice(lowestCabinVO.getPrice());
					goTrip.setSumLowestPrice(lowestCabinVO.getOriginalPrice());
					
				}
				
				if(flights.get(0).getCabin()==null)
				flights.get(0).setCabin(lowestCabinVO.getSubCabinName()==null?lowestCabinVO.getCabinType():lowestCabinVO.getSubCabinName());
				
			}
			
		}
		
		goTrip.setFlights(flights);
		
		
	// 回程信息
		
		if(null!=doubVO.getReturnPlaneInfos() && doubVO.getReturnPlaneInfos().size()>0){
			for(ReturnDoublePlaneInfo returnPlane:doubVO.getReturnPlaneInfos()){
				TripInfo returnTrip =new TripInfo();
				returnTrip.setEndTime(returnPlane.getEndTime());
				returnTrip.setFromCity(returnPlane.getFromCity());
				returnTrip.setStartTime(returnPlane.getStartTime());
				returnTrip.setToCity(returnPlane.getToCity());
				if(returnPlane.getFlightDuration()!=null && returnPlane.getFlightDuration()>0){
					returnTrip.setTotalTime(timeInMillis2Time(returnPlane.getFlightDuration()));
				}
				List<FlightInfo> returnflights =new ArrayList<FlightInfo>();
				if(null!=returnPlane.getReturnTransits()&&returnPlane.getReturnTransits().size()>1){
					returnTrip.setTrainsType(returnPlane.getReturnTransits().size()-1);
					List<TransitInfo> returnTransitInfos =new ArrayList<TransitInfo>();
					
					int i=0;
					Date arrivalTime=null;
					Long stayTime=null;
					
					for(ReturnTransit returnTransitVO:returnPlane.getReturnTransits()){
						FlightInfo flightInfo =new FlightInfo();
						String carrier=returnTransitVO.getCarrierFullName();
						if(null==carrier){
							carrier=returnTransitVO.getCarrierName();
						}
						flightInfo.setCarrier(carrier);
						flightInfo.setCabin(returnTransitVO.getCabinName());
						flightInfo.setEndTime(returnTransitVO.getEndTime());
						flightInfo.setStartTime(returnTransitVO.getStartTime());
						flightInfo.setFlightNo(returnTransitVO.getFlightNo());
						flightInfo.setFlightType(returnTransitVO.getFlightType());
						flightInfo.setSequence(i+1);
						if(i==0){
							flightInfo.setFromCity(returnPlane.getFromCity());
							flightInfo.setFromCityName(returnPlane.getFromCityName());
						}else{
							flightInfo.setFromCity(returnTransitVO.getFromAirPort());
							flightInfo.setFromCityName(returnTransitVO.getFromAirPortName());
						}
						if(i==returnPlane.getReturnTransits().size()-1){
							flightInfo.setToCity(returnPlane.getToCity());
							flightInfo.setToCityName(returnPlane.getToCityName());
						}else{
							flightInfo.setToCity(returnTransitVO.getToAirPort());
							flightInfo.setToCityName(returnTransitVO.getToAirPortName());
						}
						returnflights.add(flightInfo);
						
						if(i>0){
							TransitInfo transitInfo=new TransitInfo();
							transitInfo.setArrivalTime(arrivalTime);
							transitInfo.setDepartureTime(returnTransitVO.getStartTime());
							transitInfo.setSequence(i);
							transitInfo.setPort(returnTransitVO.getFromAirPort());
							transitInfo.setPortName(returnTransitVO.getFromAirPortName());
//							if(null!=arrivalTime && null!=returnTransitVO.getStartTime()){
//								transitInfo.setStayTime(dateDifference(arrivalTime, returnTransitVO.getStartTime()));
//							}else 
							if(stayTime!=null && stayTime>0){
								transitInfo.setStayTime(timeInMillis2Time(stayTime));
							}
							returnTransitInfos.add(transitInfo);
						}
						arrivalTime=returnTransitVO.getEndTime();
						stayTime=returnTransitVO.getStayTime();
						i++;
					}
					
					returnTrip.setTransits(returnTransitInfos);
					
				}else{
					FlightInfo flightInfo =new FlightInfo();
					String carrier=returnPlane.getCarrierFullName();
					if(null==carrier){
						carrier=returnPlane.getCarrierName();
					}
					flightInfo.setCarrier(carrier);
					flightInfo.setSequence(1);
				//	flightInfo.setCabin(cabin);
					flightInfo.setEndTime(returnPlane.getEndTime());
					flightInfo.setStartTime(returnPlane.getStartTime());
					flightInfo.setFlightNo(returnPlane.getFlightNo());
					flightInfo.setFlightType(returnPlane.getFlightType());
					flightInfo.setFromCity(returnPlane.getFromCity());
					flightInfo.setFromCityName(returnPlane.getFromCityName());
					flightInfo.setToCity(returnPlane.getToCity());
					flightInfo.setToCityName(returnPlane.getToCityName());
					returnflights.add(flightInfo);
					
				}
				if(null!=returnPlane.getReturnStopOvers() && returnPlane.getReturnStopOvers().size()>0){
					List<StopoverInfo> stopovers=new ArrayList<StopoverInfo>();
					int i=1;
					for(ReturnStopOver stopOverVO:returnPlane.getReturnStopOvers()){
						StopoverInfo stopoverInfo =new StopoverInfo();
						i++;
						stopoverInfo.setArrivalTime(stopOverVO.getArrTime());
						stopoverInfo.setDepartureTime(stopOverVO.getLeaveTime());
						stopoverInfo.setCity(stopOverVO.getStopCity());
//						if(null!=stopOverVO.getArrTime() && null!= stopOverVO.getLeaveTime()){
//							stopoverInfo.setStayTime(dateDifference(stopOverVO.getArrTime(), stopOverVO.getLeaveTime()));
//						}else
						if(null!=stopOverVO.getStayTime() && stopOverVO.getStayTime()>0){
							stopoverInfo.setStayTime(timeInMillis2Time(stopOverVO.getStayTime()));
						}
						
						stopovers.add(stopoverInfo);
					}
					returnflights.get(0).setStopovers(stopovers);
				}
				
				
				if(null!=returnPlane.getReturnCabins()&&returnPlane.getReturnCabins().size()>0){
					ReturnCabin lowestCabinVO =null;
					for(ReturnCabin cabin:returnPlane.getReturnCabins()){
						if(null!=cabin.getPrice() && cabin.getPrice()>0){
							if(null==lowestCabinVO ){
								lowestCabinVO=cabin;
							}else if(cabin.getPrice()<lowestCabinVO.getPrice()){
								lowestCabinVO=cabin;
							}
						}else if(null!=cabin.getOriginalPrice() && cabin.getOriginalPrice()>0){
							if(null==lowestCabinVO ){
								lowestCabinVO=cabin;
							}else if(cabin.getOriginalPrice()<lowestCabinVO.getOriginalPrice()){
								lowestCabinVO=cabin;
							}
						}
					}
					if(null!=lowestCabinVO && null!=lowestCabinVO.getPrice()){
						if( (lowestCabinVO.getPrice().intValue()!=returnPlane.getTotalLowestPrice().intValue() && lowestCabinVO.getPrice()>0) || 
								(lowestCabinVO.getOriginalPrice()>0 && lowestCabinVO.getOriginalPrice().intValue()!=returnPlane.getSumLowestPrice().intValue()) ){
							returnTrip.setTotalLowestTaxesPrice(lowestCabinVO.getTaxesPrice());
							returnTrip.setLowestPrice(lowestCabinVO.getPrice());
							returnTrip.setSumLowestPrice(lowestCabinVO.getOriginalPrice());
						}
						if(flights.get(0).getCabin()==null)
						flights.get(0).setCabin(lowestCabinVO.getSubCabinName()==null?lowestCabinVO.getCabinType():lowestCabinVO.getSubCabinName());
					}
				}
				returnTrip.setFlights(returnflights);
			
			
			PlaneInfo planeInfo =new PlaneInfo();
			planeInfo.setFlightDate(doubVO.getFlightDate());
			planeInfo.setReturnFlightDate(doubVO.getReturnFlightDate());
			planeInfo.setFromCity(doubVO.getFromCity());
			planeInfo.setFromCityName(doubVO.getFromCityName());
			planeInfo.setToCity(doubVO.getToCity());
			planeInfo.setToCityName(doubVO.getToCityName());
			planeInfo.setGrabDate(doubVO.getGrabDate());
			planeInfo.setGrabChannel(doubVO.getAttachHbaseKey());
			planeInfo.setGrabChannelName(doubVO.getGrabChannelName());
			planeInfo.setGoTrip(goTrip);
			planeInfo.setReturnTrip(returnTrip);
			planeInfo.setTotalLowestTaxesPrice(returnPlane.getTotalLowestTaxesPrice());
			planeInfo.setLowestPrice(returnPlane.getTotalLowestPrice());
			planeInfo.setSumLowestPrice(returnPlane.getSumLowestPrice());
			list.add(planeInfo);
			}
		}else{
			PlaneInfo planeInfo =new PlaneInfo();
			planeInfo.setFlightDate(doubVO.getFlightDate());
			planeInfo.setReturnFlightDate(doubVO.getReturnFlightDate());
			planeInfo.setFromCity(doubVO.getFromCity());
			planeInfo.setFromCityName(doubVO.getFromCityName());
			planeInfo.setToCity(doubVO.getToCity());
			planeInfo.setToCityName(doubVO.getToCityName());
			planeInfo.setGrabDate(doubVO.getGrabDate());
			planeInfo.setGrabChannel(doubVO.getAttachHbaseKey());
			planeInfo.setGrabChannelName(doubVO.getGrabChannelName());
			planeInfo.setGoTrip(goTrip);
			planeInfo.setTotalLowestTaxesPrice(doubVO.getTotalLowestTaxesPrice());
			planeInfo.setLowestPrice(doubVO.getTotalLowestPrice());
			planeInfo.setSumLowestPrice(doubVO.getSumLowestPrice());
			list.add(planeInfo);
		}
		
		return list;
	}

}
